import React, { useState, useCallback } from 'react'

export default function App() {
  const [c, setC] = useState(0)
  // function fn() {
  //   setC(c + 1)
  // }

  const fn = useCallback(function () {
    // setC((c) => {
    //   return c + 1
    // })
    setC(c + 1)
  }, [c])
  return (
    <div>
      App
      <p>{c}</p>
      <button onClick={fn}>+</button>
    </div>
  )
}
